 define(['zepto','layer'], function ($,layer) {
	var app={
		//显示加载层
		showLoad:function(shade,shadeClose){
			var lay=layer.open({content: '',type:2,shade:shade,shadeClose:shadeClose});
			return lay;
		},
		//提示信息
		showMessage:function(type,msg,success){
			var icon=type=="success"?6:5;
			var lay=layer.open({
				icon:icon,
				title:"Message",
		    	content:msg,
		    	btn: ['OK'],
		    	yes: function(index){
			        layer.close(index);
			  		if(typeof success =="function"){
			  			success();
			  		}
			    }
			});
			return lay;
		},
		//操作提示信息
		showConfirm:function(msg,success){
			var _this=this;
			layer.open({
				title:"Message",
			    content:msg,
			    btn: ["ok", "cancel"],
			    shadeClose: false,
			    yes: function(index){
			    	layer.close(index);
			    	if(typeof success =="function"){
			    		success(index);
			    	}
			    }, no: function(index){
			        layer.close(index);
			    }
			});
		},
		getScrollTop:function(){
			var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
		　  if(document.body){
		　　　　bodyScrollTop = document.body.scrollTop;
		　　}
		　　if(document.documentElement){
		　　　　documentScrollTop = document.documentElement.scrollTop;
		　　}
		　　scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
		　　return scrollTop;
		},
		getScrollHeight:function(){
			var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
		　　if(document.body){
		　　　　bodyScrollHeight = document.body.scrollHeight;
		　　}
		　　if(document.documentElement){
		　　　　documentScrollHeight = document.documentElement.scrollHeight;
		　　}
		　　scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
		　　return scrollHeight;
		},
		getWindowHeight:function(){
			var windowHeight = 0;
		　　if(document.compatMode == "CSS1Compat"){
		　　　　windowHeight = document.documentElement.clientHeight;
		　　}else{
		　　　　windowHeight = document.body.clientHeight;
		　　}
		　　return windowHeight;
		}
	};
	return app;
});
